package ShenBlueCenter.Inc;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ShenBlueInc.Center.Login_Center;

/**
 * Servlet implementation class ForGetUser
 */
@WebServlet("/ForGetUser")
public class ForGetUser extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ForGetUser() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		response.setContentType("application/json");
		response.setCharacterEncoding("utf8");
		Login_Center loginc=new Login_Center();
		String tele=request.getParameter("telephone");
		String password = request.getParameter("password");
		String safe=request.getParameter("SafeValue");
		if(loginc.forget(tele, safe, password)) {
			response.getWriter().append("{\"error\":\"重置失败您的手机号或密保错误\"}");
			return;
		}
		response.getWriter().append("{\"msg\":\"重置成功，请重新登录\"}");
		return;
	}

}
